<template>
  <div class="group">
    <div class="address">
      <div>
        <p>您当前所在位置</p>
        <router-link to="/" class="link">预览订单-团体</router-link>
      </div>
    </div>
    <div class="roder-details">
      <a-tabs default-active-key="1">
        <a-tab-pane key="1" tab="订单基本信息">
          <div class="info">

            <div class="box">
              <!--<a href="" class="dc" style="cursor: pointer;">导出</a>-->
              <h3 class="title">订单基础信息</h3>
              <div class="list">
                <div class="list-div">
                  <div>
                    <p>订单编号</p>
                    <span>{{ baseData.orderSn }}</span>
                  </div>
                  <div>
                    <p>门店名称</p>
                    <span>{{ baseData.storeCode }}</span>
                  </div>
                  <div>
                    <p>创建时间</p>
                    <span>{{ baseData.createTime }}</span>
                  </div>

                  <!--                  <div>
                                      <p>订单金额</p>
                                      <span>{{ baseData.orderMoney }}元</span>
                                    </div>-->
                  <div>
                    <p>公司名称</p>
                    <span v-if="baseData.customerInfo!=null">{{ baseData.customerInfo.customerName }}</span>
                  </div>
                  <!--                  <div>
                                      <p>面料来源</p>
                                      <span>{{ baseData.fabricSource }}</span>
                                    </div>-->
                  <!--                  <div>
                                      <p>订单名称</p>
                                      <span>{{ baseData.orderName }}</span>
                                    </div>-->
                  <div>
                    <p>业务来源</p>
                    <span>{{ baseData.businessSource }}</span>
                  </div>

                  <div>
                    <p>下单员工</p>
                    <span>{{ baseData.empName }}</span>
                  </div>
                  <div>
                    <p>快递方式</p>
                    <!--                    <span>{{ baseData.courierName }}</span>-->
                    <span v-if="baseData.courierId=='1'">顺丰快递</span>
                    <span v-if="baseData.courierId=='2'">申通快递</span>
                    <span v-if="baseData.courierId=='3'">中通快递</span>
                    <span v-if="baseData.courierId=='4'">德邦快递</span>
                  </div>
                  <div>
                    <p>包装方式</p>
                    <span>{{ baseData.packageType }}</span>
                  </div>
                  <div style="width: 50%">
                    <p>地址</p>
                    <span>{{ baseData.address }}</span>
                  </div>
                </div>
              </div>
              <div class="list" style="margin-bottom: 0px;">
                <div class="list-div">
                  <div>
                    <p>公司备注</p>
                    <span>{{ baseData.remark }}</span>
                  </div>
                </div>
              </div>
            </div>

            <div class="box">

              <h3 class="title">采购项列表</h3>
              <!--部门产品列表-->
              <div v-for="(item,key) in departProductlist" :key="item.id">
                <div class="list" style="margin-bottom: 20px;">
                  <div class="list-div">
                    <div>
                      <p>采购项名称</p>
                      <span>{{ item.departName }}</span>
                    </div>
                    <div>
                      <p>收货人</p>
                      <span>{{ item.consignee }}</span>
                    </div>
                    <div>
                      <p>收货电话</p>
                      <span>{{ item.phone }}</span>
                    </div>

                    <div style="width: 100%">
                      <p>收货地址</p>
                      <span>{{ item.address }}</span>
                    </div>

                    <div style="width: 100%">
                      <p>备注</p>
                      <span>{{ item.remark }}</span>
                    </div>
                  </div>
                </div>
                <div class="table-css" style="margin-bottom: 20px;">
                  <a-table class="table1" lign="center" :columns="depProduct"
                           :data-source="item.productInfos"
                           :pagination="false">
                    <!-- <p slot="xiuziWeizhi" slot-scope="text">
                         <span v-if="text == '1'">{{text}}</span>
                         <router-link v-else to="/MyOrderSubsystem/CustomizesInfo"
                                      style="color:#C49D18">
                             定制款(查看详细)
                         </router-link>
                     </p>
                     <p slot="allConColor" slot-scope="text">
                         <span v-if="text != '1'">{{text}}</span>
                         <router-link v-else to="/MyOrderSubsystem/CustomizesInfo"
                                      style="color:#C49D18">
                             定制款(查看详细)
                         </router-link>
                     </p>-->
                    <p slot="action" slot-scope="text,record">
                      <!--<span v-if="text != '1'">{{text}}</span>-->
                      <router-link
                          :to="{path:'/MyOrderSubsystem/CustomizesInfo',query:{product:record.id}}"
                          style="color:#C49D18">
                        查看详细
                      </router-link>
                    </p>
                  </a-table>
                </div>
              </div>

              <!--这是员工列表-->
              <h3 class="title">员工列表</h3>
              <div v-for="(item,key) in departProductlist" :key="item.id">
                <p style="font-size: 16px;font-weight: 700;">{{ item.departName }}</p>
                <el-button type="primary" style="margin-bottom:10px" @click="download(item.id)">下载量体表</el-button>
                <div class="table-css" style="margin-bottom: 20px;">
                  <a-table class="table1" lign="center" :columns="emp"
                           :data-source="item.smallPro"
                           :pagination="false">
                    <p slot="k6" slot-scope="text,record">
                      <!--<span v-if="text == '2'" style="color:#C49D18">套号量体</span>-->
                      <span style="color:#C8442A">{{ record.bodysType == '0' ? '自定义尺码' : '标准尺码' }}</span>
                    </p>
                    <p slot="k7" slot-scope="text,record">
                      <router-link
                          :to="{path:'/MyOrderSubsystem/CustomizesClothesInfo',query:{proID:record.id,orderSn:$route.query.order}}"
                          style="color:#C8442A">查看详情
                      </router-link>
                    </p>
                  </a-table>
                </div>
              </div>

            </div>

            <div class="box">

              <!--<h3 class="title">订单附加条件</h3>
              <div class="tabs" style="margin-bottom: 20px;">
                  <div class="tab">
                      <h5>式样</h5>
                      <div class="tab-content">
                          &lt;!&ndash;<p v-for="item in tab1Data" :key="item.id"
                             :class="{'active':tab1Idx == item.id}">{{item.name}}</p>&ndash;&gt;
                          <p>{{baseData.shiyang}}</p>
                      </div>
                  </div>
                  <div class="tab">
                      <h5>紧急指数</h5>
                      <div class="tab-content">
                          <p>{{baseData.emergency}}</p>
                      </div>
                  </div>
                  <div class="tab">
                      <h5>改款打样</h5>
                      <div class="tab-content">
                          <p>{{baseData.modifiedYang}}</p>
                      </div>
                  </div>
                  <div class="tab">
                      <h5>品牌标</h5>
                      <div class="tab-content">
                          &lt;!&ndash;<p v-for="item in tab4Data" :key="item.id"
                             :class="{'active':tab4Idx == item.id}">{{item.name}}</p>&ndash;&gt;
                          <p>{{baseData.brandLabel}}</p>
                      </div>
                  </div>
                  <div class="tab">
                      <h5>订单备注</h5>
                      <div class="tab-content">
                          &lt;!&ndash;<p v-for="item in tab5Data" :key="item.id"
                             :class="{'active':tab5Idx == item.id}">{{item.name}}</p>&ndash;&gt;
                          <p>{{baseData.remark}}</p>
                      </div>
                  </div>
              </div>-->

              <h3 class="title">订单费用明细</h3>
              <h4 class="title2">面料费用</h4>
              <div class="table-css">

                <a-table class="table1" lign="center" :columns="fabriclist"
                         :data-source="orderDetail.allFabric"
                         :pagination="false">
                  <!--<a slot="k7" slot-scope="text" style="color:#C49D18">{{text}}</a>
                  <a slot="k6" slot-scope="text" style="color:#C49D18">{{text}}</a>
                  <a slot="k8" slot-scope="text" style="color:#C49D18">{{text}}</a>-->
                </a-table>
              </div>
              <h5 class="price1">面料费用小计：<span>{{ orderDetail.fabricPriceAll }}元</span></h5>

              <h4 class="title2">加工费用</h4>
              <!--                            <div>
                                              <div class="table-css">
                                                  <a-table class="table1" lign="center" :columns="allprolist"
                                                           :data-source="proPriceList"
                                                           :pagination="false">
                                                      &lt;!&ndash;<a slot="k7" slot-scope="text" style="color:#C49D18">{{text}}</a>
                                                      <a slot="k6" slot-scope="text" style="color:#C49D18">{{text}}</a>
                                                      <a slot="k8" slot-scope="text" style="color:#C49D18">{{text}}</a>&ndash;&gt;
                                                  </a-table>
                                              </div>
                                          </div>-->
              <p style="font-weight: bolder">标准码加工费用</p>
              <div>
                <div class="table-css">
                  <a-table class="table1" lign="center" :columns="allprolist"
                           :data-source="bzmPriceList"
                           :pagination="false">
                  </a-table>
                </div>
              </div>

              <p style="font-weight: bolder">团订加工费用</p>
              <div>
                <div class="table-css">
                  <a-table class="table1" lign="center" :columns="allprolist"
                           :data-source="zdyPriceList"
                           :pagination="false">
                  </a-table>
                </div>
              </div>

              <h4 class="title2">加价项目</h4>
              <div>
                <div class="table-css">
                  <a-table class="table1" lign="center" :columns="fuwuFabricTitle"
                           :data-source="shouFeiList"
                           :pagination="false">
                  </a-table>
                </div>
              </div>

              <h5 class="price1">加工费用小计(包含辅料价格)：<span>{{ allProductMoney }}元</span></h5>

              <h4 class="title2">收费服务</h4>
              <div>
                <div class="table-css">
                  <a-table class="table1" lign="center" :columns="jiajia"
                           :data-source="jiajiaList"
                           :pagination="false">
                  </a-table>
                </div>
              </div>
              <h5 class="price1">加价服务小计：<span>{{ alljiajiaPrice }}元</span></h5>

              <div class="prices">
                <!--                <h5 class="price">订单费用总计：<span>{{ orderDetail.orderMoney }}元</span></h5>-->
                <h5 class="price">订单费用总计：<span>{{
                    Number(this.orderDetail.fabricPriceAll) + Number(this.allProductMoney) + Number(this.alljiajiaPrice)
                  }}元</span></h5>
                <!--<h5 class="price">支付方式：月结</h5>-->
              </div>

              <h3 class="title">订单备注</h3>
              <textarea class="text1" disabled v-model="baseData.remark"
                        style="color: rgb(153, 153, 153);"></textarea>

              <div class="btns">
                <div class="btn1" @click="$router.go(-1)">返回</div>
              </div>
            </div>
          </div>
        </a-tab-pane>

      </a-tabs>

    </div>

  </div>
</template>

<script>

// 收费服务项
const fuwuFabricTitle = [{
  title: '序号',
  dataIndex: '',
  key: 'rowIndex',
  align: 'center',
  customRender: function (t, r, index) {
    return parseInt(index) + 1
  }
},
  {
    title: '品类名称',
    align: "center",
    dataIndex: 'plname'
  },
  {
    title: '产品名称',
    align: "center",
    dataIndex: 'productName'
  },
  {
    title: '加价项目',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '总数量',
    align: "center",
    dataIndex: 'num'
  },
  {
    title: '总金额',
    align: "center",
    dataIndex: 'price'
  },
];

// 部门下员工列表
const emp = [
  {
    title: '序号',
    dataIndex: '',
    key: 'rowIndex',
    align: 'center',
    customRender: function (t, r, index) {
      return parseInt(index) + 1
    }
  },
  {
    title: '员工姓名',
    align: "center",
    dataIndex: 'customerName'
  },
  {
    title: '性别',
    align: "center",
    dataIndex: 'sex',
    customRender: function (t, r, index) {
      if (t == 1) {
        return '男'
      } else {
        return '女'
      }
    }
  },
  {
    title: '员工编号',
    align: "center",
    dataIndex: 'customerCode'
  },
  {
    title: '产品名称',
    align: "center",
    dataIndex: 'productName'
  },
  {
    title: '尺码',
    dataIndex: 'k6',
    scopedSlots: {
      customRender: 'k6'
    },
  },
  {
    title: '量体数据',
    dataIndex: 'k7',
    scopedSlots: {
      customRender: 'k7'
    },
  }
];

// 这是订单的所有面料列表
const fabriclist = [
  {
    title: '序号',
    dataIndex: '',
    key: 'rowIndex',
    align: 'center',
    customRender: function (t, r, index) {
      return parseInt(index) + 1
    }
  },
  {
    title: '面料编号',
    align: "center",
    dataIndex: 'fabricCode'
  },
  {
    title: '米数',
    align: "center",
    dataIndex: 'mishu'
  },
  {
    title: '阶梯价',
    align: "center",
    dataIndex: 'fabricPrice'
  },
  {
    title: '客户折扣',
    align: "center",
    dataIndex: 'kehuzk',
    customRender: function (text) {
      if (text == 1) {
        return '100%'
      } else {
        return Number(text) * 100 + '%'
      }
    }
  },
  {
    title: '折后单价',
    align: "center",
    dataIndex: 'afterPrice'
  },
  {
    title: '总金额',
    align: "center",
    dataIndex: 'allPrice'
  },
];

const columns5 = [{
  dataIndex: 'k1',
  key: 'k1',
  title: '序号',
},
  {
    title: '产品名称',
    dataIndex: 'k2',
    key: 'k2',
  },
  {
    title: '产品货号',
    dataIndex: 'k3',
    key: 'k3',
  },
  {
    title: '件数',
    key: 'k4',
    dataIndex: 'k4'
  },
  {
    title: '标准单价',
    key: 'k5',
    dataIndex: 'k5'
  },
  {
    title: '阶梯折扣',
    key: 'k6',
    dataIndex: 'k6',
    scopedSlots: {
      customRender: 'k6'
    },
  },
  {
    title: '客户折扣',
    key: 'k7',
    dataIndex: 'k7',
    scopedSlots: {
      customRender: 'k7'
    },
  },
  {
    title: '折后单价',
    key: 'k8',
    dataIndex: 'k8',
    scopedSlots: {
      customRender: 'k8'
    },
  },
  {
    title: '总金额',
    key: 'k9',
    dataIndex: 'k9',
    scopedSlots: {
      customRender: 'k9'
    },
  },
];

// 部门产品列表
const depProduct = [
  {
    title: '序号',
    dataIndex: '',
    key: 'rowIndex',
    align: 'center',
    customRender: function (t, r, index) {
      return parseInt(index) + 1
    }
  },
  {
    title: '产品货号',
    align: "center",
    dataIndex: 'productCode'
  },
  {
    title: '产品名称',
    align: "center",
    dataIndex: 'productName'
  },
  {
    title: '人均配置',
    align: "center",
    dataIndex: 'numbers'
  },
  {
    title: '绣字',
    align: "center",
    dataIndex: 'xiuziType',
    customRender: function (text) {
      if (text == null || text == '') {
        return '无绣字'
      } else {
        return text
      }
    }
  },
  /*{
    title: '价格',
    align: "center",
    key: 'allPrice',
    dataIndex: 'allPrice'
  },*/
  {
    title: '产品参数',
    dataIndex: 'action',
    align: 'center',
    // fixed:"right",
    width: 147,
    scopedSlots: {customRender: 'action'}
  }
]

const columns3 = [{
  dataIndex: 'k1',
  key: 'k1',
  title: '序号',
},
  {
    title: '产品货号',
    dataIndex: 'k2',
    key: 'k2',
  },
  {
    title: '产品名称',
    dataIndex: 'k3',
    key: 'k3',
  },
  {
    title: '产品数量',
    key: 'k4',
    dataIndex: 'k4'
  },
  {
    title: '绣字',
    key: 'k5',
    dataIndex: 'k5',
    scopedSlots: {
      customRender: 'k5'
    },
  },
  {
    title: '撞色',
    key: 'k6',
    dataIndex: 'k6',
    scopedSlots: {
      customRender: 'k6'
    },
  },
  {
    title: '自定义参数',
    key: 'k7',
    dataIndex: 'k7',
    scopedSlots: {
      customRender: 'k7'
    },
  }
];

const columns4 = [{
  dataIndex: 'k1',
  key: 'k1',
  title: '序号',
},
  {
    title: '员工姓名',
    dataIndex: 'k2',
    key: 'k2',
  },
  {
    title: '性别',
    dataIndex: 'k3',
    key: 'k3',
  },
  {
    title: '员工编号',
    key: 'k4',
    dataIndex: 'k4'
  },
  {
    title: '产品名称',
    key: 'k5',
    dataIndex: 'k5'
  },
  {
    title: '尺码',
    key: 'k6',
    dataIndex: 'k6',
    scopedSlots: {
      customRender: 'k6'
    },
  },
  {
    title: '量体数据',
    key: 'k7',
    dataIndex: 'k7',
    scopedSlots: {
      customRender: 'k7'
    },
  }
];

// 加工费用列表
const allprolist = [
  {
    title: '序号',
    dataIndex: '',
    key: 'rowIndex',
    align: 'center',
    customRender: function (t, r, index) {
      return parseInt(index) + 1
    }
  },
  {
    title: '产品名称',
    align: "center",
    dataIndex: 'productName'
  },
  {
    title: '品类',
    align: "center",
    dataIndex: 'pingleiName'
  },
  {
    title: '性别',
    align: "center",
    dataIndex: 'sex',
    customRender: function (text) {
      if (text == '0') {
        return '男'
      } else if (text == '1') {
        return '女'
      }
    }
  },
  {
    title: '数量',
    align: "center",
    dataIndex: 'num'
  },

  {
    title: '阶梯价',
    align: "center",
    dataIndex: 'singlePrice'
  },
  {
    title: '总金额',
    align: "center",
    dataIndex: 'price'
  },
];

const columns2 = [{
  dataIndex: 'k1',
  key: 'k1',
  title: '序号',
},
  {
    title: '品类',
    dataIndex: 'k2',
    key: 'k2',
  },
  {
    title: '性别',
    dataIndex: 'k3',
    key: 'k3',
  },
  {
    title: '标准单价',
    key: 'k4',
    dataIndex: 'k4'
  },
  {
    title: '阶梯折扣',
    key: 'k5',
    dataIndex: 'k5'
  },
  {
    title: '客户折扣',
    key: 'k6',
    dataIndex: 'k6',
    scopedSlots: {
      customRender: 'k6'
    },
  },
  {
    title: '折后单价',
    key: 'k7',
    dataIndex: 'k7',
    scopedSlots: {
      customRender: 'k7'
    },
  },
  {
    title: '总金额',
    key: 'k8',
    dataIndex: 'k8',
    scopedSlots: {
      customRender: 'k8'
    },
  },
];

// 团订售后列表表头
const afterTitle = [
  {
    title: '序号',
    dataIndex: '',
    key: 'rowIndex',
    align: 'center',
    customRender: function (t, r, index) {
      return parseInt(index) + 1
    }
  },
  {
    title: '售后单号',
    align: "center",
    dataIndex: 'afterCode'
  },
  {
    title: '申请时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '人员名单',
    scopedSlots: {
      customRender: 'k4'
    },
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status'
  },
  {
    title: '操作',
    align: "center",
    scopedSlots: {
      customRender: 'k6'
    }
  }
];

const columns7 = [{
  dataIndex: 'k1',
  key: 'k1',
  title: '序号',
},
  {
    title: '售后单号',
    dataIndex: 'k2',
    key: 'k2',
  },
  {
    title: '申请时间',
    dataIndex: 'k3',
    key: 'k3',
  },
  {
    title: '人员名单',
    key: 'k4',
    dataIndex: 'k4',
    scopedSlots: {
      customRender: 'k4'
    },
  },

  {
    title: '状态',
    key: 'k5',
    dataIndex: 'k5',
    scopedSlots: {
      customRender: 'k5'
    },
  },
  {
    title: '操作',
    key: 'k6',
    dataIndex: 'k6',
    scopedSlots: {
      customRender: 'k6'
    },
  }
];
const data5 = [{
  k1: '1',
  k2: 'UOSL1334',
  k3: '2020-06-10',
  k4: '查看',
  k5: '等待审核',
  k6: '查看售后状态'
}]
const data1 = [{
  k1: '1',
  k2: '23341964AQ',
  k3: '2020-06-01',
  k4: '2264AA',
  k5: '40米',
  k6: '80%',
  k7: '304元/米',
  k8: '7600元',
  k9: '1520元'
}]
const data2 = [{
  k1: '1',
  k2: 'GYS001',
  k3: '西服-上衣',
  k4: '12',
  k5: '右袖口/LOGO',
  k6: '无',
  k7: '无'
},
  {
    k1: '2',
    k2: 'GYS001',
    k3: '西服-上衣',
    k4: '12',
    k5: '1',
    k6: '1',
    k7: '1'
  }
]
const data3 = [{
  k1: '1',
  k2: '支彬',
  k3: '男',
  k4: '13616570547',
  k5: '男-西服上衣',
  k6: '2',
  k7: '2'
},
  {
    k1: '2',
    k2: 'GYS001',
    k3: '男',
    k4: '15168560965',
    k5: '男-西服上衣',
    k6: '1',
    k7: '1'
  }
];
// 加价列表表头
const jiajia = [
  {
    title: '序号',
    dataIndex: '',
    key: 'rowIndex',
    align: 'center',
    customRender: function (t, r, index) {
      return parseInt(index) + 1
    }
  },
  {
    title: '品类',
    align: "center",
    dataIndex: 'productName'
  },
  {
    title: '业务类型',
    align: "center",
    dataIndex: 'butype',
    customRender: function (text) {
      if (text == 1) {
        return '团单业务'
      } else if (text == 2) {
        return '标准码业务'
      }
    }
  },
  {
    title: '参数名称',
    align: "center",
    dataIndex: 'costName'
  },
  {
    title: '总数量',
    align: "center",
    dataIndex: 'number'
  },
  {
    title: '总金额',
    align: "center",
    dataIndex: 'price'
  },
];
// @ is an alias to /src
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
import {getAction, getFileAccessHttpUrl, postAction} from "../../api/manage";
import Qs from "qs";

let storage = window.localStorage;

export default {
  name: 'MyAfterSales',
  data() {
    return {
      fuwuFabricTitle, // 里布等表头
      shouFeiList: [], //里布、纽扣列表
      shouFeiPrice: '', // 里布、纽扣价格
      alljiajiaPrice: '', // 加价服务总价
      jiajiaList: [], // 加价列表
      jiajia,
      proPriceList: [], // 加工费用列表
      autohor_token: localStorage.getItem("token"), //token
      storage,
      orderDetail: {}, // 团订订单详情
      departProductlist: [], // 部门产品列表
      baseData: {}, // 基本信息
      bzmPriceList: [], // 加工费用列表(标准码)
      zdyPriceList: [], // 加工费用列表（自定义）
      url: {
        teamOrderChengben: '/teamOrder/teamOrderChengben', // 团订加价服务
        teamOrderPrice: '/teamOrder/teamOrderPrice', // 查询团订小产品的价格区间
        detail: '/teamOrder/previewOrder', // 团订订单详情
        getBaseTeamOrderDetail: '/teamOrder/getBaseTeamOrderDetail', // 团订订单基本信息
        shouFeifuwuXiang: '/teamOrder/shouFeifuwuXiang', // 里布等价格
        updateOrder: '/logic/interface/update_team_order' // 更新订单
      },
      // 分页
      pagination: {
        current: '',
        total: 0,
        pageSize: 10,//每页中显示10条数据
      },
      selectedRowKeys: [],
      depProduct,// 部门产品表头
      emp,
      columns2,
      allprolist,
      fabriclist,
      columns3,
      columns4,
      columns5,
      afterTitle,
      columns7,
      data5,
      data3,
      data1,
      data2,
      locale,
      tab1Data: [{
        id: 1,
        name: '无需试穿'
      }],
      tab1Idx: -1,
      tab2Data: [{
        id: 1,
        name: '常规',
        hoveName: '7个工作日'
      }],
      tab2Idx: -1,
      tab3Data: [{
        id: 1,
        name: '来款/样式'
      },],
      tab3Idx: -1,
      tab4Data: [{
        id: 1,
        name: '派定制'
      },],
      tab4Idx: -1,
      tab5Data: [{
        id: 1,
        name: '备注信息'
      },],
      tab5Idx: -1,
    }
  },
  computed: {
    rowSelection() {
      return {
        onChange: (selectedRowKeys, selectedRows) => {
          // console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
        },
        getCheckboxProps: record => ({
          props: {
            disabled: record.name === 'Disabled User', // Column configuration not to be checked
            name: record.name,
          },
        }),
      };
    },
  },
  created() {
    this.getBaseDetail()
    this.getOrderDetail()
    this.updateTeamOrder()
    this.teamOrderPriceFunc()
    this.shouFeifuwuXiangFunc()
    this.teamOrderChengbenFunc()
  },
  methods: {

    /**
     * 下载
     */
    download(id) {
      let url = getFileAccessHttpUrl(domain.publicUrl + "/teamOrder/departProExcel3?departId=" + id)
      window.open(url);
    },

    /**
     * 获取里布价格列表
     */
    shouFeifuwuXiangFunc() {
      getAction(domain.publicUrl + this.url.shouFeifuwuXiang, {
        'orderSn': this.$route.query.order
      }).then(res => {
        if (res.data.code == '0') {
          this.shouFeiList = res.data.data
          this.shouFeiPrice = res.data.price
        }
      })
    },

    /**
     * 获取团订加价服务
     */
    teamOrderChengbenFunc() {
      getAction(domain.publicUrl + this.url.teamOrderChengben, {
        'orderSn': this.$route.query.order
      }).then(res => {
        if (res.data.code == '0') {
          this.jiajiaList = res.data.data
          this.alljiajiaPrice = res.data.allMoney
        }
      })
    },

    /**
     *加工费用列表
     */
    teamOrderPriceFunc() {
      getAction(domain.publicUrl + this.url.teamOrderPrice, {
        'orderSn': this.$route.query.order
      }).then(res => {
        if (res.data.code == '0') {
          this.bzmPriceList = res.data.bzm
          this.zdyPriceList = res.data.zdy
          this.allProductMoney = res.data.allMpney
        } else {
          this.$message.error("查询失败")
        }
      })
    },

    // 预览订单需要实时更新订单
    updateTeamOrder() {
      // 公司信息
      let companyDetail = JSON.parse(this.storage.getItem('groupOrder_companyFrom'));
      // 门店信息
      let storeDetail = JSON.parse(this.storage.getItem('groupOrder_baseFrom'));
      let param = {
        token: this.autohor_token,
        orderSn: this.storage.getItem("orderSn"),
        status: 0,
        orderName: companyDetail.orderName,
        storeId: storeDetail.storeId,
        storeCode: storeDetail.storeCode,
        fabricSource: storeDetail.fabricSource,
        businessSource: storeDetail.businessSource,
        courierId: storeDetail.courierId,
        packageType: storeDetail.packageType,
        addressType: storeDetail.addressType,
        address: storeDetail.address,
        customerId: this.storage.getItem("customerId"),
        remark: companyDetail.remark
      }
      postAction(domain.publicUrl + this.url.updateOrder, Qs.stringify(param)).then(res => {
        if (res.data.code == '0') {
          // this.$message.success("保存成功")
        }
      })
    },

    // 获取订单基本信息
    getBaseDetail() {
      getAction(domain.publicUrl + this.url.getBaseTeamOrderDetail, {
        'token': this.autohor_token,
        'orderSn': this.$route.query.order
      }).then(res => {
        if (res.data.code == '0') {
          this.baseData = res.data.data
        }
      })
    },

    // 获取团订订单详情
    getOrderDetail() {
      const loading = this.$loading({
        lock: true,
        text: '数据拼命加载中...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      getAction(domain.publicUrl + this.url.detail, {
        'orderSn': this.$route.query.order
      }).then(res => {
        loading.close();
        if (res.data.code == '0') {
          this.orderDetail = res.data.data
          this.departProductlist = res.data.data.departs
        }
      })
    },

    // 分页器方法
    handleTableChange(page, pageSize) {
      getAction(domain.publicUrl + this.url.listTeamAfter, {
        'pageNo': page.current,
        'pageSize': page.current.pageSize,
        'token': this.autohor_token,
        'orderSn': this.$route.query.order,
        'orderType': 1
      }).then(res => {
        if (res.data.code == '0') {
          this.afterlist = res.data.data.records
          this.pagination.total = res.data.data.total
          this.pagination.current = res.data.data.current
        }
      })
    },

    selectTab: function (dataStr, i) {
      this[dataStr] = i
    }
  }
}
</script>

<style scoped lang="scss">
.roder-details {
  width: 80%;
  margin: 0 auto;
  margin-top: 20px;
  padding: 20px 35px;

  .box {
    background-color: #fff;
    padding: 30px;
    padding-left: 54px;
    margin-bottom: 20px;
    position: relative;
  }


  .info {
    position: relative;
    min-height: 800px;
    position: relative;

    .dc {
      position: absolute;
      right: 20px;
      top: 15px;
      z-index: 11;
      width: 95px;
      height: 38px;
      display: flex;
      font-family: 'PingFangSC-Medium', 'PingFang SC Medium', 'PingFang SC';
      font-weight: 500;
      font-style: normal;
      align-items: center;
      justify-content: center;
      background-image: url(../../assets/u9117.svg);
      font-size: 13px;
      color: #333;

    }


    .view-order {
      width: 107px;
      border-width: 0px;
      position: absolute;
      right: 0px;
      top: 0px;
      width: 105px;
      height: 42px;
      background: inherit;
      background-color: rgba(81, 81, 81, 1);
      border: none;
      border-radius: 3px;
      box-shadow: none;
      font-weight: 500;
      font-style: normal;
      font-size: 13px;
      text-align: center;
      display: block;
      color: rgb(236, 227, 0);
      line-height: 40px;
      margin-right: 20px;
      cursor: pointer;
    }

    .price1 {
      color: rgb(38, 38, 38);
      font-size: 16px;
      font-weight: 400;
      padding: 2px 2px 2px 24px;

      span {
        color: rgb(215, 1, 1);
      }

      margin: 35px 0px;
    }

    .text11 {
      display: flex;
      margin-bottom: 20px;

      & > p {
        width: 100px;
        font-weight: 100;
        font-size: 14px;
        color: #333;

      }

      div {
        h5 {
          color: #333;
          font-size: 15px;
          font-weight: 500;

          display: block;
        }

        p {
          color: #333;
          font-size: 15px;
          font-weight: 100;

          display: block;
        }
      }
    }

    .title10 {
      color: #333;
      font-weight: 700;
      font-size: 16px;
      line-height: 16px;
      margin-bottom: 20px;
      position: relative;
    }

    .text10 {
      display: flex;
      margin-bottom: 20px;

      & > p {
        width: 100px;
        font-weight: 100;
        font-size: 14px;
        color: #333;

      }

      div {
        span {
          color: #333;
          font-size: 15px;
          font-weight: 100;

          &.b {
            font-weight: 500;
          }

          display: block;
        }
      }
    }

    .table-css {
      position: relative;

      .bz {
        width: 447px;
        height: 63px;
        background: inherit;
        background-color: rgba(255, 221, 202, 1);
        position: absolute;
        right: 0px;
        top: -63px;
        display: flex;
        align-items: center;
        justify-content: center;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        flex-direction: column;

        p {
          width: 100%;
          color: rgb(251, 8, 8);
          font-size: 13px;
          padding-left: 10px;
          margin-bottom: 0px;
          line-height: 16px;
        }
      }
    }

    .btns {
      margin-top: 25px;
      margin-bottom: 60px;
      display: flex;

      .btn1 {

        border-width: 0px;
        width: 105px;
        height: 42px;
        background: inherit;
        background-color: rgba(81, 81, 81, 1);
        border: none;
        border-radius: 3px;
        -moz-box-shadow: none;
        -webkit-box-shadow: none;
        box-shadow: none;
        font-family: 'PingFangSC-Medium', 'PingFang SC Medium', 'PingFang SC';
        font-weight: 500;
        font-style: normal;
        font-size: 13px;
        text-align: center;
        display: block;
        color: rgb(236, 227, 0);
        line-height: 40px;
        margin-right: 20px;
        cursor: pointer;
      }

      .btn2 {

        border-width: 0px;
        width: 105px;
        height: 42px;
        background: inherit;
        background-color: rgba(244, 244, 244, 1);
        border: none;
        border-radius: 3px;
        -moz-box-shadow: none;
        -webkit-box-shadow: none;
        box-shadow: none;
        font-family: 'PingFangSC-Medium', 'PingFang SC Medium', 'PingFang SC';
        font-weight: 500;
        font-style: normal;
        font-size: 13px;
        text-align: center;
        display: block;
        color: rgb(104, 104, 104);
        line-height: 40px;
        margin-right: 20px;
        cursor: pointer;
      }
    }

    .prices {
      display: flex;

      .price {
        width: 50%;
      }
    }

    .price {
      color: rgb(38, 38, 38);
      font-size: 16px;
      font-weight: 700;

      span {
        color: rgb(215, 1, 1);
      }

      margin: 35px 0px;
    }

    .text1 {
      width: 533px;
      height: 105px;
      padding: 3px 2px 3px 2px;
      font-family: 'ArialMT', 'Arial';
      font-weight: 400;
      font-style: normal;
      font-size: 13px;
      text-decoration: none;
      letter-spacing: normal;
      color: #000000;
      vertical-align: none;
      text-align: left;
      text-transform: none;
      background-color: #f9f9f9;
      border-color: transparent;
      resize: none;
      outline: none;
      padding: 10px;
    }

    .tabs {
      .tab {
        margin-bottom: 10px;
        display: flex;

        h5 {
          width: 112px;
          padding: 2px 2px 2px 24px;
          background-color: rgba(249, 249, 249, 1);
          font-size: 15px;
          color: #333;
          display: flex;
          height: 36px;
          align-items: center;
          margin: 0px !important;
          margin-right: 6px !important;
        }

        .tab-content {
          height: 36px;
          display: flex;

          p {
            border: 1px solid rgb(242, 242, 242);
            min-width: 100px;
            height: 36px;
            height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 15px;
            color: #333;
            font-size: 15px;
            margin-right: 6px;

            cursor: pointer;

            b {
              display: none;
              font-weight: 700;
            }

            &.active {
              color: rgb(255, 236, 112);
              font-weight: 700;
              background-color: rgb(74, 74, 74);
            }

            &:hover {
              b {
                display: block;
              }

              span {
                display: none;
              }
            }
          }
        }
      }
    }

    h3.title {
      height: 30px;
      line-height: 30px;
      position: relative;
      font-size: 16px;
      color: #333;
      font-weight: 700;
      margin-bottom: 25px;

      &:after {
        position: absolute;
        height: 100%;
        width: 5px;
        position: absolute;
        left: -25px;
        top: 0px;
        background-color: rgba(74, 74, 74, 1);
        content: "";
      }
    }

    .title2 {
      width: 112px;
      padding: 2px 2px 2px 24px;
      font-size: 15px;
      color: #333;
      display: flex;
      height: 36px;
      align-items: center;
      margin: 0px !important;
      margin-bottom: 10px !important;
      font-weight: 700;
    }

    .list {
      margin-bottom: 20px;

      .list-div {
        display: flex;
        flex-wrap: wrap;

        div {
          width: 33.3%;
          display: flex;
          height: 36px;
          align-items: center;

          p {
            width: 112px;
            padding: 2px 2px 2px 24px;
            background-color: rgba(249, 249, 249, 1);
            font-size: 15px;
            color: #333;
            display: flex;
            height: 36px;
            align-items: center;
            margin: 0px !important;
          }

          span {
            width: calc(100% - 112px);
            padding: 2px 2px 2px 24px;
            font-size: 15px;
            color: #333;
            display: flex;
            height: 36px;
            align-items: center;

            &.b {
              font-weight: 700;
            }
          }
        }
      }
    }
  }
}
</style>
